/*
 * printf_bsp.c
 *
 *  Created on: Dec 8, 2020
 *      Author: Administrator
 */

#include	"printf_bsp.h"
#include	"stdio.h"

#ifdef __GNUC__

#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)

PUTCHAR_PROTOTYPE
{
    //注意下面第一个参数是&husart1，因为cubemx配置了串口1自动生成的
	HAL_UART_Transmit(&huart4, (uint8_t*)&ch, 1, HAL_MAX_DELAY);
    return ch;
}
#endif


#define		PRINTF_SYSINFO_SPAN		1000

void	printf_sysinfo_process(void)
{
	static	uint32_t	printf_stamp = 0;
	static  int32_t		print_cnt=0;
	if(HAL_GetTick()-printf_stamp >= PRINTF_SYSINFO_SPAN)
	{
		printf_stamp = HAL_GetTick();
		printf("Systick(ms):%d\r\n", printf_stamp);
		print_cnt++;
		printf ("Print_cnt:%ld\n", print_cnt);

	}
}





